#ifndef LINESEGMENT_H
#define LINESEGMENT_H
#include <QLine>
#include "point.h"
namespace GeometryUtilities
{
  class LineSegment
  {
    public:
      LineSegment();
      LineSegment(const Point& begin, const Point& end);

      QLineF toQLineF() const;

      const Point& begin() const;
      Point& begin();

      const Point& end() const;
      Point& end();
      LineSegment toPerpendicularFromBegin(qreal offset, qreal magnitude) const;
      LineSegment toPerpendicularFromEnd(qreal offset,qreal magnitude) const;
      LineSegment toOffset(qreal offset) const;

      virtual Point closestPointOn(const Point& p) const;
      virtual bool isPointOn(const Point& p) const;
      virtual bool operator==(const LineSegment& rhs) const;

    protected:
      Point mBegin;
      Point mEnd;
  };
}

#endif // LINESEGMENT_H
